﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;

namespace OopProperty
{
    internal class People
    {
        private int _pid = 0; // 定义成员变量并赋初始值为0
        public int PId
        {
            get
            {
                return _pid;
            }
            set
            {
                _pid = value;
            }
        }
        public string Name { get; set; } = "张三";
        public string Description { get; set; }

        private int _age;

        public int Age
        {
            get
            {
                return _age;
            }
            set
            {
                if (value > 100)
                {
                    _age = 100;
                }
                else
                {
                    _age = value;
                }
            }
        }

        public void ShowInfo()
        {
            Console.WriteLine($"PId={PId},Name={Name},Desc={Description}");
        }
    }
}
